package com.springinaction.knights.aop.demo04;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * XML将Minstrel配置为切面
 */
public class KnightMain {

    public static void main(String[] args) {

        ApplicationContext context = new ClassPathXmlApplicationContext("springBean/demo04/knight.xml");
//        使用BraveKnight转换会报类型转换异常，因为JDK proxy的原因。。。
//        Knight knight = (BraveKnight) context.getBean("knight");
        Knight knight = (Knight) context.getBean("knight");
        knight.embarkOnQuest();
    }
}
